﻿
@{
    Layout = null;
    var returnUrl = Request.QueryString["returnUrl"];
    if (!string.IsNullOrEmpty(returnUrl)) {
        returnUrl = System.Web.HttpUtility.UrlDecode(returnUrl);
    }
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>登录</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0, user-scalable=no" />
    <link href="~/Content/css/base.css" rel="stylesheet" />
    <link rel="stylesheet" href="~/Content/css/tuoken.css" />
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/js/base.js"></script>
    <script src="~/Content/js/layer/1.9.3/layer.js"></script>
</head>
<body>
    <div class="aboutwhite">
        <div class="autoinfoct">
            <a href="javascript:history.go(-1);" class="backbtn">
                <span class="back"></span>
            </a>
            <div class="login">
                <form action="" method="">
                    <div class="logininput phoneBox">
                        <div class="phoneSelect relative">
                            <i class="jiao_down absolute"></i>
                            <select class="fn-left mobile_code">
                                <option>+86</option>
                                <option>+886</option>
                            </select>
                        </div>
                        <div class="hidden">
                            <input class="name" type="text" id="phone" placeholder="请输入账号">
                        </div>
                    </div>
                    <div class="logininput loginiyzm">
                        @*<span class="wjmm fn-right border-none"><a class="fn12 col-gray" href="/home/forget@(!string.IsNullOrEmpty(returnUrl) ? "?returnUrl=" + System.Web.HttpUtility.UrlEncode(returnUrl) :"")">忘记密码</a></span>*@
                        <input class="nickname" type="password" id="yzm" placeholder="登录密码">
                    </div>

                    <input type="button" class="ui-btn-auto on" id="autobtn" value="立即登录" disabled="disabled" style="margin-bottom: 0;">
                    @*<input type="button" class="ui-btn-auto ui-btn-auto-b" value="短信登录" onclick="javascript:window.location.href='/home/LoginCode@(!string.IsNullOrEmpty(returnUrl) ? "?returnUrl=" + System.Web.HttpUtility.UrlEncode(returnUrl) :"")'" style="margin-bottom: 0;margin-top: 10px;">*@
                    <div class="logininput clear" style="border: none;">
                        <a class="fn-right fn12" href="/home/forget@(!string.IsNullOrEmpty(returnUrl) ? "?returnUrl=" + System.Web.HttpUtility.UrlEncode(returnUrl) :"")">忘记密码</a>
                        <a class="fn12 fn-left" href="/home/Register@(!string.IsNullOrEmpty(returnUrl) ? "?returnUrl=" + System.Web.HttpUtility.UrlEncode(returnUrl) :"")">注册</a>
                        @*<a class="fn12 fn-left" href="/home/LoginCode@(!string.IsNullOrEmpty(returnUrl) ? "?returnUrl=" + System.Web.HttpUtility.UrlEncode(returnUrl) :"")">短信登录</a>*@
                        
                    </div>
                </form>
            </div>
        </div>
    </div>


        <script type="text/javascript">
            $(function () {
                var flag = false;
                $("#autobtn").click(function () {
                    var creg = /^(13[0-9]|14[5-9]|15[012356789]|166|17[0-8]|18[0-9]|19[89])[0-9]{8}$/;
                    var treg = /^09\d{8}$/;
                    var mobile = $("#phone").val();
                    var password = $("#yzm").val();
                    if (!(creg.test(mobile) || treg.test(mobile))) {
                        layer.msg("请输入正确的手机号");
                        return ;
                    }
                    if (mobile.length == 0) {
                        layer.msg("手机号码不能为空");
                        return ;
                    }
                    if (password.length==0) {
                        layer.msg("请输入密码");
                        return;
                    }
                    if (flag) return;
                    flag = true;
                    $.ajax({
                        //几个参数需要注意一下
                        type: "POST",//方法类型
                        dataType: "json",//预期服务器返回的数据类型
                        url: "/Home/LoginByPwd",//url
                        data: { mobile: mobile, password: password },
                        success: function (result) {
                            if (result.result_code == 1000) {
                                layer.msg("登录成功");
                                window.location.href = '@Html.Raw((!string.IsNullOrEmpty(returnUrl) ? returnUrl : "/home/index"))';
                            } else {
                                layer.msg(result.result_msg);
                            }
                            flag = false;
                        },
                        error: function () {
                            layer.msg("异常！");
                            flag = false;
                        }
                    });
                });
            });
            $(".logininput input").keyup(function () {

                var phone = $("#phone").val();
            var yzm = $("#yzm").val();

                if (phone != "" && yzm != "") {
                $("#autobtn").attr("disabled", false);
            $('#autobtn').addClass('on');
                } else {
                $("#autobtn").attr("disabled", true);

            $('#autobtn').removeClass('on');
        }
})


    </script>



</body>
</html>
